home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / DevPac v3.02b.adf / include / devices / trackdisk.i < prev   
Text File  |  1991-11-20  |  5KB  |  182 lines

  1.     IFND    DEVICES_TRACKDISK_I
  2. DEVICES_TRACKDISK_I    SET    1
  3. **
  4. **    $Filename: devices/trackdisk.i $
  5. **    $Release: 1.3 $
  6. **
  7. **    
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. **
  12.  
  13.     IFND    EXEC_IO_I
  14.     INCLUDE "exec/io.i"
  15.     ENDC    ; EXEC_IO_I
  16.  
  17.     IFND    EXEC_DEVICES_I
  18.     INCLUDE "exec/devices.i"
  19.     ENDC    ; EXEC_DEVICES_I
  20.  
  21. *--------------------------------------------------------------------
  22. *
  23. * Physical drive constants
  24. *
  25. *--------------------------------------------------------------------
  26.  
  27.  
  28. * OBSOLETE -- only valid for 3 1/4" drives.  Use the TD_GETNUMTRACKS command!
  29. *
  30. *NUMCYLS        EQU    80        ; normal # of cylinders
  31. *MAXCYLS        EQU    NUMCYLS+20    ; max # of cyls to look for
  32. *                        ;    during a calibrate
  33. *NUMHEADS    EQU    2
  34. *NUMTRACKS    EQU    NUMCYLS*NUMHEADS
  35.  
  36. NUMSECS        EQU    11
  37. NUMUNITS    EQU    4
  38.  
  39. *--------------------------------------------------------------------
  40. *
  41. * Useful constants
  42. *
  43. *--------------------------------------------------------------------
  44.  
  45.  
  46. *-- sizes before mfm encoding
  47. TD_SECTOR    EQU    512
  48. TD_SECSHIFT    EQU    9            ; log TD_SECTOR
  49. *                        ;    2
  50.  
  51.  
  52. *--------------------------------------------------------------------
  53. *
  54. * Driver Specific Commands
  55. *
  56. *--------------------------------------------------------------------
  57.  
  58. *-- TD_NAME is a generic macro to get the name of the driver.  This
  59. *-- way if the name is ever changed you will pick up the change
  60. *-- automatically.
  61. *--
  62. *-- Normal usage would be:
  63. *--
  64. *-- internalName:    TD_NAME
  65. *--
  66.  
  67. TD_NAME:    MACRO
  68.         DC.B    'trackdisk.device',0
  69.         DS.W    0
  70.         ENDM
  71.  
  72.     BITDEF    TD,EXTCOM,15
  73.  
  74.     DEVINIT
  75.     DEVCMD    TD_MOTOR        ; control the disk's motor
  76.     DEVCMD    TD_SEEK            ; explicit seek (for testing)
  77.     DEVCMD    TD_FORMAT        ; format disk
  78.     DEVCMD    TD_REMOVE        ; notify when disk changes
  79.     DEVCMD    TD_CHANGENUM        ; number of disk changes
  80.     DEVCMD    TD_CHANGESTATE        ; is there a disk in the drive?
  81.     DEVCMD    TD_PROTSTATUS        ; is the disk write protected?
  82.     DEVCMD    TD_RAWREAD        ; read raw bits from the disk
  83.     DEVCMD    TD_RAWWRITE        ; write raw bits to the disk
  84.     DEVCMD    TD_GETDRIVETYPE        ; get the type of the disk drive
  85.     DEVCMD    TD_GETNUMTRACKS        ; get the # of tracks on this disk
  86.     DEVCMD    TD_ADDCHANGEINT        ; TD_REMOVE done right
  87.     DEVCMD    TD_REMCHANGEINT        ; removes softint set by ADDCHANGEINT
  88.     DEVCMD    TD_LASTCOMM        ; dummy placeholder for end of list
  89.  
  90.  
  91. *
  92. *
  93. * The disk driver has an "extended command" facility.  These commands
  94. * take a superset of the normal IO Request block.
  95. *
  96. ETD_WRITE    EQU    (CMD_WRITE!TDF_EXTCOM)
  97. ETD_READ    EQU    (CMD_READ!TDF_EXTCOM)
  98. ETD_MOTOR    EQU    (TD_MOTOR!TDF_EXTCOM)
  99. ETD_SEEK    EQU    (TD_SEEK!TDF_EXTCOM)
  100. ETD_FORMAT    EQU    (TD_FORMAT!TDF_EXTCOM)
  101. ETD_UPDATE    EQU    (CMD_UPDATE!TDF_EXTCOM)
  102. ETD_CLEAR    EQU    (CMD_CLEAR!TDF_EXTCOM)
  103. ETD_RAWREAD    EQU    (TD_RAWREAD!TDF_EXTCOM)
  104. ETD_RAWWRITE    EQU    (TD_RAWWRITE!TDF_EXTCOM)
  105.  
  106.  
  107. *
  108. * extended IO has a larger than normal io request block.
  109. *
  110.  
  111.  STRUCTURE IOEXTTD,IOSTD_SIZE
  112.     ULONG    IOTD_COUNT    ; removal/insertion count
  113.     ULONG    IOTD_SECLABEL    ; sector label data region
  114.     LABEL    IOTD_SIZE
  115.  
  116. *
  117. * raw read and write can be synced with the index pulse.  This flag
  118. * in io request's IO_FLAGS field tells the driver that you want this.
  119. *
  120.     BITDEF    IOTD,INDEXSYNC,4
  121.  
  122. * labels are TD_LABELSIZE bytes per sector
  123.  
  124. TD_LABELSIZE    EQU    16
  125.  
  126. *
  127. * This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  128. * the driver will allow you to open all the disks that the trackdisk
  129. * driver understands.  Otherwise only 3.5" disks will succeed.
  130. *
  131. *
  132.     BITDEF    TD,ALLOW_NON_3_5,0
  133.  
  134. *
  135. *  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  136. *  know what type of disk you really got.  These defines are for the
  137. *  TD_GETDRIVETYPE command.  In addition, you can find out how many
  138. *  tracks are supported via the TD_GETNUMTRACKS command.
  139. *
  140. DRIVE3_5    EQU    1
  141. DRIVE5_25    EQU    2
  142.  
  143. *--------------------------------------------------------------------
  144. *
  145. * Driver error defines
  146. *
  147. *--------------------------------------------------------------------
  148.  
  149. TDERR_NotSpecified    EQU    20    ; general catchall
  150. TDERR_NoSecHdr        EQU    21    ; couldn't even find a sector
  151. TDERR_BadSecPreamble    EQU    22    ; sector looked wrong
  152. TDERR_BadSecID        EQU    23    ; ditto
  153. TDERR_BadHdrSum        EQU    24    ; header had incorrect checksum
  154. TDERR_BadSecSum        EQU    25    ; data had incorrect checksum
  155. TDERR_TooFewSecs    EQU    26    ; couldn't find enough sectors
  156. TDERR_BadSecHdr        EQU    27    ; another "sector looked wrong"
  157. TDERR_WriteProt        EQU    28    ; can't write to a protected disk
  158. TDERR_DiskChanged    EQU    29    ; no disk in the drive
  159. TDERR_SeekError        EQU    30    ; couldn't find track 0
  160. TDERR_NoMem        EQU    31    ; ran out of memory
  161. TDERR_BadUnitNum    EQU    32    ; asked for a unit > NUMUNITS
  162. TDERR_BadDriveType    EQU    33    ; not a drive that trackdisk groks
  163. TDERR_DriveInUse    EQU    34    ; someone else allocated the drive
  164. TDERR_PostReset        EQU    35    ; user hit reset; awaiting doom
  165.  
  166. *--------------------------------------------------------------------
  167. *
  168. * Public portion of unit structure
  169. *
  170. *--------------------------------------------------------------------
  171.  
  172.  STRUCTURE TDU_PUBLICUNIT,UNIT_SIZE
  173.     UWORD    TDU_COMP01TRACK        ; track for first precomp
  174.     UWORD    TDU_COMP10TRACK        ; track for second precomp
  175.     UWORD    TDU_COMP11TRACK        ; track for third precomp
  176.     ULONG    TDU_STEPDELAY        ; time to wait after stepping
  177.     ULONG    TDU_SETTLEDELAY        ; time to wait after seeking
  178.     UBYTE    TDU_RETRYCNT        ; # of times to retry
  179.     LABEL    TDU_PUBLICUNITSIZE
  180.  
  181.     ENDC    ; DEVICES_TRACKDISK_I
  182.